using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using Afrs.Draco.Prms.Client.Proxy;
using Afrs.Prms.DataObject;

namespace 
{
  /// <summary>
  /// Tdocuments Test Class
  /// </summary>
  [TestClass]
  public class TestTdocuments
  {
    #region Class Variables
    private CdoPrms<DOTdocuments>		m_Tdocuments;
    private CdoPrmsList<DOTdocuments>	m_AllTdocuments;
    #endregion

    #region Class Constructors & Destructors
    /// <summary>
    /// Constructs the test
    /// </summary>
    public TestTdocuments()
    {
      // Create the data objects
      this.m_Tdocuments	= new CdoPrms<DOTdocuments>();
      this.m_AllTdocuments	= new CdoPrmsList<DOTdocuments>();
    }
    #endregion

    #region Class Methods
    /// <summary>
    /// Retrieves all Tdocuments data objects
    /// </summary>
    [TestMethod]
    public void TdocumentsRetrieveAll()
    {
      // Set up the data object for list retrieval
      this.m_AllTdocuments.DataObject = new DOTdocuments();
      this.m_AllTdocuments.ListAction = AfrsDOListAction.Retrieve;

      // Perform the action and determine the success
      if (!this.m_AllTdocuments.PerformAction())
      {
        // Assert the errors
        if (this.m_AllTdocuments.Errors.Count > 0) { Assert.Fail(this.m_AllTdocuments.Errors[0].Message); }
        else { Assert.Fail("Unknown error occurred"); }
      }

      // Return to calling method
      return;
    }

    /// <summary>
    /// Create a new Tdocuments
    /// </summary>
    [TestMethod]
    public void TdocumentsCreate()
    {
      // Set up the data object for creation
      this.m_Tdocuments.DataObject.d_status = "Test d_status";
      this.m_Tdocuments.DataObject.d_match = false;
      this.m_Tdocuments.DataObject.d_exist = false;
      this.m_Tdocuments.DataObject.d_folder = "Test d_folder";
      this.m_Tdocuments.DataObject.d_loc = "Test d_loc";
      this.m_Tdocuments.DataObject.d_accno = "Test d_accno";
      this.m_Tdocuments.DataObject.d_fileno = "Test d_fileno";
      this.m_Tdocuments.DataObject.d_doctype = "Test d_doctype";
      this.m_Tdocuments.DataObject.d_stand = "Test d_stand";
      this.m_Tdocuments.DataObject.d_suburb = "Test d_suburb";
      this.m_Tdocuments.DataObject.d_complex = "Test d_complex";
      this.m_Tdocuments.DataObject.d_custid = "Test d_custid";
      this.m_Tdocuments.DataObject.d_custname1 = "Test d_custname1";
      this.m_Tdocuments.DataObject.d_custname2 = "Test d_custname2";
      this.m_Tdocuments.DataObject.d_lasttran = DateTime.Now;
      this.m_Tdocuments.DataObject.d_user = "Test d_user";
      this.m_Tdocuments.DataObject.d_goldate = DateTime.Now;
      this.m_Tdocuments.DataObject.d_mbno = "Test d_mbno";
      this.m_Tdocuments.DataObject.d_tdno = "Test d_tdno";
      this.m_Tdocuments.DataObject.d_hogno = "Test d_hogno";
      this.m_Tdocuments.DataObject.d_onwins = "Test d_onwins";
      this.m_Tdocuments.DataObject.d_owninsno = "Test d_owninsno";
      this.m_Tdocuments.DataObject.d_lifecomp = "Test d_lifecomp";
      this.m_Tdocuments.DataObject.d_lifeno = "Test d_lifeno";
      this.m_Tdocuments.DataObject.d_lifecess = "Test d_lifecess";
      this.m_Tdocuments.DataObject.d_lifewaiver = DateTime.Now;
      this.m_Tdocuments.DataObject.d_govtee = "Test d_govtee";
      this.m_Tdocuments.DataObject.d_letsure = DateTime.Now;
      this.m_Tdocuments.DataObject.d_nhbrc = false;
      this.m_Tdocuments.DataObject.d_authpmt = false;
      this.m_Tdocuments.DataObject.d_gpadate = DateTime.Now;
      this.m_Tdocuments.DataObject.d_addendum = "Test d_addendum";
      this.m_Tdocuments.DataObject.d_notes = "Test d_notes";
      this.m_Tdocuments.DataObject.d_releasetype = "Test d_releasetype";
      this.m_Tdocuments.DataObject.d_releasereason = "Test d_releasereason";
      this.m_Tdocuments.DataObject.d_primaryattorney = "Test d_primaryattorney";
      this.m_Tdocuments.DataObject.d_secondaryattorney = "Test d_secondaryattorney";
      this.m_Tdocuments.DataObject.d_notifyreturned = false;
      this.m_Tdocuments.DataObject.d_releasedate = DateTime.Now;
      this.m_Tdocuments.DataObject.d_returndate = DateTime.Now;
      this.m_Tdocuments.DataObject.d_primaryattorneyletterreference = "Test d_primaryattorneyletterreference";
      this.m_Tdocuments.DataObject.d_secondaryattorneyletterreference = "Test d_secondaryattorneyletterreference";
      this.m_Tdocuments.DataObject.d_trackingnumber = "Test d_trackingnumber";
      this.m_Tdocuments.DataObject.Action = AfrsDataObjectAction.Create;

      // Perform the action and determine the success
      if (!this.m_Tdocuments.PerformAction())
      {
        // Assert the errors
        if (this.m_Tdocuments.Errors.Count > 0) { Assert.Fail(this.m_Tdocuments.Errors[0].Message); }
        else { Assert.Fail("Unknown error occurred"); }
      }

      // Return to calling method
      return;
    }

    /// <summary>
    /// Retrieves a specific Tdocuments
    /// </summary>
    [TestMethod]
    public void TdocumentsRetrieve()
    {
      // Determine whether the data object needs to be specified
      if (this.m_Tdocuments.DataObject.Id == 0)
      {
        // Specify the data object to retrieve
        this.m_Tdocuments.DataObject.d_id = "Test d_id";
      }

      // Set up the data object action for retrieval
      this.m_Tdocuments.DataObject.Action = AfrsDataObjectAction.Retrieve;

      // Perform the action and determine the success
      if (!this.m_Tdocuments.PerformAction())
      {
        // Assert the errors
        if (this.m_Tdocuments.Errors.Count > 0) { Assert.Fail(this.m_Tdocuments.Errors[0].Message); }
        else { Assert.Fail("Unknown error occurred"); }
      }

      // Return to calling method
      return;
    }
    #endregion
  }
}
